/*
* Copyright 2016 YONYOU Corporation Ltd. All Rights Reserved.
*
* This software is published under the terms of the YONYOU Software
* License version 1.0, a copy of which has been included with this
* distribution in the LICENSE.txt file.
*
* @Project         marketing

* @Package         com.yonyou.marketing.message.push.provider.impl

* @Author          LuZhen

* @FileName        AbstractProviderMessage

* @Date            16/11/10

----------------------------------------------------------------------------------
*     Date          Who             Version         Comments
* 1. 16/11/10        LuZhen          1.0             Create Source
*
----------------------------------------------------------------------------------
*/
package com.yonyou.gmmc.service.wechatpush.provider.impl;

import org.marketing.common.constants.MessagePushConstant;

import com.yonyou.gmmc.service.wechatpush.provider.ProviderMessage;
import com.yonyou.gmmc.service.wechatpush.resolver.PushMessage;

public abstract class AbstractProviderMessage implements ProviderMessage {

    public PushMessage getPushMessage() {
        return pushMessage;
    }

//    public void setPushMessage(PushMessage pushMessage) {
//        this.pushMessage = pushMessage;
//    }

    protected PushMessage pushMessage;

    @Override
    public MessagePushConstant.PUSH_PLATFORM getPlatForm() {
        return pushMessage.getOrigin().getReceiver().getPlatform();
    }

    /**
     * 填充消息
     * @param pushMessage   PushMessage
     */
    @Override
    public void fillContent(PushMessage pushMessage){
        this.pushMessage = pushMessage;
        transform();
    }

    protected abstract void transform();

    @Override
    public PushMessage getOrigin() {
        return this.pushMessage;
    }
}
